package com.cloud.punish.workflow.enums;

public enum TimeUnitEnum {
	HOUR(1, "小时"), DAY(2, "天"), WEEK(3, "周");

	private int timeUnitId;
	private String timeUnitName;

	private TimeUnitEnum(int timeUnitId, String timeUnitName) {
		this.timeUnitId = timeUnitId;
		this.timeUnitName = timeUnitName;
	}

	public int getTimeUnitId() {
		return timeUnitId;
	}

	public String getTimeUnitName() {
		return timeUnitName;
	}

	public static TimeUnitEnum getUnit(int id) {
		for (TimeUnitEnum unit : TimeUnitEnum.values()) {
			if (unit.getTimeUnitId() == id) {
				return unit;
			}
		}
		return null;
	}
}
